package main

import "fmt"

func main() {

	s := []int{1, 2, 3, 4}

	s1 := s[0:2]
	fmt.Printf("s1 len = %d, cap = %d, slice = %v\n", len(s1), cap(s1), s1)
	//原数组都会发生改变
	s1[0] = 100

	//copy 可以将底层数组的slice一起进行拷贝
	s2 := make([]int, 3) //s2 = [0,0,0]

	//将s中的值 依次拷贝到s2中
	copy(s2, s)
	fmt.Println(s2)
}
